<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>问卷发布</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/dtree.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/font/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/darkBlue.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/work/question/question.css"/>
    <style>
        .quesition-tj-list dl dd {
            padding: 10px 0px 10px;
        }
    </style>
</head>
<body class="wrap-container clearfix">
<div class="column-content-detail">
    <div class="quesition-tj-tit">${question.title}</div>
    <div class="questionnaire-style-txt">
        <p>问卷类型：<span><#if question?? && question.type == '1'>扫码问卷<#else>对象问卷</#if></span>
            <#if question?? && question.type == '2'>
            问卷对象：<span><#if question?? && question.objectType == '1'>
                            所有人
                            <#elseif question?? && question.objectType == '2'>
                            教师
                            <#elseif question?? && question.objectType == '3'>
                            学生
                            <#else>
                            自定义对象
                            </#if>
                      </span>
            </#if>
        </p>
        <p>开放时间：${question.startTime?string('yyyy-MM-dd')}~${question.endTime?string('yyyy-MM-dd')}</p>
        <#if question?? && question.remark !=null && question.remark !="">
        <p>问卷描述：<span>${question.remark}</span></p>
        </#if>
    </div>
    <div class="quesition-tj-list">
        <#if question.subjectList?? && (question.subjectList?size > 0)>
        <#list question.subjectList as subject>
        <#if subject.type == '1' || subject.type == '2'>
        <dl>
            <dt>${subject.orderNum}、${subject.title}<#if subject.type == '1'>[单选题]<#else>[多选题]</#if></dt>
            <#list subject.selectList as subjectSelect>
            <dd>
                <div>${subjectSelect.num}.${subjectSelect.title}</div>
            </dd>
            </#list>
        </dl>
        <#else>
        <dl>
            <dt>${subject.orderNum}、${subject.title}[简答题]</dt>
        </dl>
        </#if>
        </#list>
        </#if>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
            <button class="layui-btn layui-btn-normal" type="button" id="publishBtn">发布</button>
            <button class="layui-btn layui-btn-primary" type="button" id="cancel">取消</button>
        </div>
    </div>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/lib/KnifeZ/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>

    layui.use(['form', 'jquery', 'page','dialog'], function () {
        var $ = layui.jquery,
            form = layui.form,
            dialog = layui.dialog,
            page = layui.page;
        form.render();

        var id = '${question.id}';
        var parentMenuId = '${parentMenuId}';

        $('#cancel').bind('click', function () {
            if (id) {
                parent.tabDelete("publish" + id);
            } else {
                parent.tabDelete('questionEdit');
            }
        });

        $('#publishBtn').bind('click', function () {
            page.delete('/work/question/updateStatus', {"id": id, status: '3'}, "您确定要发布该问卷吗？", function () {
                // 需要刷新新页面
                dialog.msg("保存成功");
                parent.tabRefresh(parentMenuId);
                if (id) {
                    parent.tabDelete(id);
                } else {
                    parent.tabDelete('questionEdit');
                }
            });
        });
    });

</script>
</body>
</html>